package com.cqq.boot.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cqq.boot.domain.Hotel;
import com.cqq.boot.mapper.HotelMapper;
import com.cqq.boot.service.HotelService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

@Service("hotelService")
public class HotelServiceImpl implements HotelService{

	@Autowired
	private HotelMapper hotelMapper;
	
	public Hotel findById(int id) {
		return hotelMapper.selectByPrimaryKey(id);
	}

	public List<Hotel> queryHotels() {
		return hotelMapper.queryHotels();
	}

	public int add(Hotel hotel) {
		return hotelMapper.insertSelective(hotel);
	}

	public Page<Hotel> queryPage(int pageNum, int pageSize) {
		PageHelper.startPage(pageNum, pageSize);
		return hotelMapper.queryPage();
	}

}
